<?php

class SessionSupport {

    static function logar($res) {
        if ($res) {
            $_SESSION['usuario']['id'] = (string) CriptSupport::encrypt($res->id, $res->salt);
            $_SESSION['usuario']['nome'] = (string) $res->nome;
            $_SESSION['usuario']['email'] = (string) $res->email;
        }
        return $res;
    }

    static function logof() {
        try {
            session_destroy();
            return true;
        } catch (PDOException $e) {
            print $e->getMessage();
        }
    }

}
